<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>使用ajax()方法加载服务器数据</title>
		<script src="./jquery.js" type="text/javascript"></script>
	</head>
	<body>
		<h2>检测数字的奇偶性</h2>
		<label>
			<input id="txtNumber" type="text" size="12" value="0"/>
		</label><input id="btnCheck" type="button" value="检测" />
		<ul></ul>
		<script type="text/javascript">
			$(function() {
				$("#btnCheck").bind("click", function() {
					$txtNum = $("#txtNumber").val()
					$.ajax({
						url: "http://localhost:8080/jqurey-test-demo/check.php",
						data: {
							num: $txtNum
						},
						type: "post",
						dataType: "text",
						success: function(data) {
							$("ul").append(`<li>你输入的【${$txtNum}】是：${data}</li>`)
						}
					});
				})
			});
		</script>
	</body>
</html>
